<include file="common:__head__"/>
<div class="permissions-tabs">
    <a class="role tabs-bg" href="{:U('members/member_list')}">会员列表</a>
</div>
<div class="permissions-content">
    <div class="permissions-le">
        <div class="add-msg">
            <a class="add-role" href="{:U('Members/member_add')}">添加会员</a>
            <a class="add-role changeS" href="javascript:;" do="open">开启</a>
            <a class="add-role changeS" href="javascript:;" do="close">关闭</a>
            <div class="add-form">
                <form method="get" action="" onsubmit="return false;">
                    <select id="u_status" class="select">
                        <option value="">选择状态</option>
                        <option value="0">关闭</option>
                        <option value="1">正常</option>
                        <option value="2">待审</option>
                    </select>
                    <input type="hidden" name="m" value="seller"/>
                    <input type="hidden" name="c" value="members"/>
                    <input type="hidden" name="a" value="member_list"/>
                    <input type="hidden" id="orderby1" value="agent_id"/>
                    <input type="hidden" id="orderby2" value="DESC"/>
                    <div class="add-ipt">
                        <input placeholder="姓名/手机" type="text" id="mName" class="add-name" />
                        <button type="button" onclick="search_data();"></button>
                    </div>
                </form>
            </div>
        </div>

        <div class="permissions-table">
            <form action="{:U('Agent/batchDo')}" method="post" id="smt">
                <input type="hidden" name="type" value="" id="do_type"/>
                <table border="0" width="100%">
                    <thead>
                    <tr>
                        <td><input type="checkbox" id="check_all"/></td>
                        <td>ID</td>
                        <td>会员名称</td>
                        <td>手机号码</td>
                        <td>邮箱</td>
                        <td>预存款</td>
                        <td>状态</td>
                        <td>操作</td>
                    </tr>
                    </thead>
                    <tbody class="trade-setting" id="ajax_return"></tbody>
                </table>
            </form>
        </div>
    </div>
    <div class="permissions-ri">
        <a href="" class="permissions-help">帮助和服务</a>
    </div>
</div>

<!--<div id="dialog" title="会员余额充值">-->
    <!--<p>这是一个默认的对话框，用于显示信息。对话框窗口可以移动，调整尺寸，默认可通过 'x' 图标关闭。</p>-->
<!--</div>-->

<script type="text/javascript">
    $(document).ready(function(){
        // ajax 加载商品列表
        ajax_get_table(1);

        $('.changeS').click(function ()
        {
            var do_type = $(this).attr("do");
            layer.confirm('您确认进行此操作吗？', {
                btn: ['确认','取消']
            }, function(){
                $("#do_type").attr("value", do_type);
                $("#smt").submit();
            });
        });
    });
    // ajax 抓取页面 form 为表单id  page 为当前第几页
    function ajax_get_table(page){
        cur_page = page; //当前页面 保存为全局变量
        $.ajax({
            type : "POST",
            url:"{:U('Members/ajax_normal_list')}",
            data : {
                p :page,
                mName :$("#mName").val(),
                reg :$("#reg").val(),
                u_status :$("#u_status").val(),
                orderby1 :$("#orderby1").val(),
                orderby2 :$("#orderby2").val()
            },
            success: function(data){
                $("#ajax_return").html('');
                $("#ajax_return").append(data);
            }
        });
    }

    // 点击排序
    function sort(field)
    {
        $("#orderby1").val(field);
        var v = $("#orderby2").val() == 'desc' ? 'asc' : 'desc';
        $("#orderby2").val(v);
        ajax_get_table(cur_page);
    }
</script>
<include file="common:__foot__"/>